<template>
	<view>
		<pageHeader  @back='back' >
			<text>个人主页</text>
		</pageHeader>
		<view style="height: 1rpx;background-color:#DDDDDD ;"></view>
		<view class="body">
			<view class="body_item">
				<view class="leader">
					<text>真</text>
					<text>实</text>
					<text>姓</text>
					<text>名</text>
				</view>
				<text class="value">{{message.username?message.username:message.nickname}}</text>
			</view>
			<view class="body_item">
				<view class="leader">
					<text>公</text>
					<text>司</text>
					<text>名</text>
					<text>称</text>
				</view>
				<text class="value">{{message.companyName}}</text>
			</view>
			<view class="body_item">
				<view class="leader">
					<text>办</text>
					<text>公</text>
					<text>地</text>
					<text>址</text>
				</view>
				<text class="value">{{workAddress}}</text>
			</view>
			<view class="body_item">
				<view class="leader">
					<text>联</text>
					<text>系</text>
					<text>方</text>
					<text>式</text>
				</view>
				<text class="value">{{message.telephone}}</text>
			</view>
			<view class="body_item" v-if="message.email&&message.email!=' '">
				<view class="leader">
					<text>邮</text>
					<text>箱</text>
				</view>
				<text class="value">{{message.email}}</text>
			</view>
			<view class="body_item">
				<view class="leader">
					<text>服</text>
					<text>务</text>
					<text>地</text>
					<text>区</text>
				</view>
				<text class="value">{{serviceAddress}}</text>
			</view>
			<view class="body_item">
				<view class="leader">
					<text>入</text>
					<text>行</text>
					<text>年</text>
					<text>份</text>
				</view>
				<text class="value">{{message.designTime}}年</text>
			</view>
			<view class="body_item">
				<view class="leader">
					<text>入</text>
					<text>驻</text>
					<text>时</text>
					<text>间</text>
				</view>
				<text class="value">{{message.settleTime}}</text>
			</view>
			<view class="body_item">
				<view class="leader">
					<text>设</text>
					<text>计</text>
					<text>类</text>
					<text>型</text>
				</view>
				<text class="value">{{designType}}</text>
			</view>
			<view class="body_item">
				<view class="leader">
					<text>团</text>
					<text>队</text>
					<text>介</text>
					<text>绍</text>
				</view>
				<text class="value">{{message.teamDetail}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	import url from '@/common/util/personal.js'
	import pageHeader from "@/components/header/header.vue"
	export default {
		components: {pageHeader},
		data() {
			return {
				userId:localStorage.getItem("userId"),
				message:{}
			};
		},
		onLoad(e) {
			this.userId=e.userId
			this.getMessage()
		},
		computed: {
			workAddress() {
				let fullPath
				try{
					if(this.message.workAddress.province.indexOf('市')!=-1){
						fullPath=this.message.workAddress.province+this.message.workAddress.area
					}else if(this.message.workAddress.city.indexOf('省直辖县级行政区划')!=-1||this.message.workAddress.city.indexOf('自治区直辖县级行政区划')!=-1){
						fullPath=this.message.workAddress.province+this.message.workAddress.area
					}else{
						fullPath=this.message.workAddress.province+this.message.workAddress.city+this.message.workAddress.Area+this.message.workAddress.detailed
					}
				}catch(e){
					
				}
				return fullPath 
			},
			serviceAddress(){
				try{
					return this.message.serviceAddress.join("、")
				}catch(e){
					return ""
				}
			},
			designType(){
				try{
					let list=[],fullList=JSON.parse(this.message.designType)
					for(let a=0;a<fullList.length;a++){
						list.push(fullList[a].content)
					}
					return list.join("、")
				}catch(e){
					return ""
				}
			}
		},
		methods: {
			back(){
				uni.navigateBack({
					delta: 1
				})
			},
			async getMessage(){
				let res=await url.getDesignerInfo({userId:this.userId})
				this.message=res.data
			}
		}
	}
</script>

<style lang="scss">
.body{
	padding-left: 30rpx;
	.body_item{
		min-height: 90rpx;
		padding:20rpx 0 ;
		display: flex;
		align-items: center;
		position: relative;
		border-bottom: 1rpx solid #DDDDDD ;
		.leader{
			width:124rpx ;
			height: 30rpx;
			display: flex;
			position: absolute;
			top:30rpx;
			align-items: center;
			justify-content: space-between;
			text{
				
				font-size: 30rpx;
				line-height: 30rpx;
				color:#999999 ;
			}
		}
		.value{
			font-size: 30rpx;
			line-height: 48rpx;
			width: 506rpx;
			letter-spacing: 1rpx;
			color: #333333;
			margin-left: 174rpx;
		}
	}
}
</style>
